home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / libdl / dladdr.z / dladdr
Encoding:
Text File  |  2002-10-03  |  5.1 KB  |  122 lines

  1. DLADDR(3C)                                             Last changed: 1-8-99
  2.  
  3.  
  4. NNAAMMEE
  5.      ddllaaddddrr - Translates address to symbolic information
  6.  
  7. SSYYNNOOPPSSIISS
  8.      cccc [_f_l_a_g_s ...] [_f_i_l_e ...]
  9.  
  10.      ##iinncclluuddee <<ddllffccnn..hh>> iinntt ddllaaddddrr((vvooiidd **aaddddrreessss,, DDll__iinnffoo **ddlliipp));;
  11.  
  12. IIMMPPLLEEMMEENNTTAATTIIOONN
  13.      IRIX systems
  14.  
  15. DDEESSCCRRIIPPTTIIOONN
  16.      ddllaaddddrr(()) determines if the specified address is located within one of
  17.      the mapped objects (either the executable or a DSO) that make up the
  18.      current application address space.  If the address is within an
  19.      object, the symbol table available to the run-time linker (rrlldd(1)) is
  20.      searched to locate the nearest symbol to the specified address.  The
  21.      nearest symbol is one that has a value less than or equal to the
  22.      required address.
  23.  
  24.      The DDll__iinnffoo structure must be preallocated by the user.  The structure
  25.      members are filled in by ddllaaddddrr(()) based on the specified address.  The
  26.      DDll__iinnffoo structure contains at least the following members:
  27.  
  28.           const char * dli_fname;
  29.           void       * dli_fbase;
  30.           const char * dli_sname;
  31.           void       * dli_saddr;
  32.  
  33.      The members are defined as follows:
  34.  
  35.      ddllii__ffnnaammee
  36.           Contains a pointer to the file name of the containing object.
  37.  
  38.      ddllii__ffbbaassee
  39.           Contains the base address (in memory) of the containing object.
  40.  
  41.      ddllii__ssnnaammee
  42.           Contains a pointer to the nearest symbol name.  This symbol
  43.           either has the same address or is the nearest symbol with a lower
  44.           address.
  45.  
  46.      ddllii__ssaaddddrr
  47.           Contains the actual address of the above symbol.
  48.  
  49.      The following nonstandard field is in DDll__iinnffoo:
  50.  
  51.      ddllii__vveerrssiioonn
  52.           This is filled in with zero by ddllaaddddrr(()).
  53.  
  54. NNOOTTEESS
  55.      If no symbol is found to describe the specified address, but the
  56.      address is within a mapped-in object, the ddllii__ssnnaammee and ddllii__ssaaddddrr
  57.      members are set to 0 by ddllaaddddrr(()).
  58.  
  59.      The memory pointed to by ddllii__ffnnaammee and ddllii__ssnnaammee is within the mapped
  60.      object. If the object is closed with ddllcclloossee(()), the pointers become
  61.      invalid.
  62.  
  63.      If the call is attempted on a system that does not have the supporting
  64.      functionality, the following message will be emitted to //ddeevv//ttttyy by
  65.      default, and the application will be terminated with a non-zero exit
  66.      code:
  67.  
  68.           Fatal Error: _rld_new_interface: bad operation: 14
  69.  
  70.      Applications that might be executed on IRIX releases without the
  71.      latest rrlldd should first attempt the call in a separate small process.
  72.      Define the environment variable __RRLLDD__AARRGGSS as the following to direct
  73.      the rrlldd message to disk, if its appearance on //ddeevv//ttttyy might be an
  74.      annoyance:
  75.  
  76.           -log /tmp/rldmessage
  77.  
  78.      On a development system with ddllffccnn..hh missing DDll__iinnffoo and lliibbcc missing
  79.      ddllaaddddrr(()), but with rrlldd implementing __RRLLDD__DDLLAADDDDRR, the following is a
  80.      sample implementation that you might want to try.  This sample
  81.      implementation is not guaranteed to work, because user applications
  82.      and DSOs should not call __rrlldd__nneeww__iinntteerrffaaccee, but it is provided with
  83.      the hope that it will be useful.
  84.  
  85.           #include <rld_interface.h>
  86.           #ifndef _RLD_INTERFACE_DLFCN_H_DLADDR
  87.           #define _RLD_INTERFACE_DLFCN_H_DLADDR
  88.           struct Dl_info {
  89.               const char * dli_fname;
  90.               void       * dli_fbase;
  91.               const char * dli_sname;
  92.               void       * dli_saddr;
  93.               int          dli_version;
  94.               int          dli_reserved1;
  95.               long         dli_reserved[4];
  96.           };
  97.           #endif
  98.           #define _RLD_DLADDR             14
  99.           int dladdr(void *address, struct Dl_info *dl);
  100.  
  101.           int dladdr(void *address, struct Dl_info *dl)
  102.           {
  103.                   void *v;
  104.                   v = _rld_new_interface(_RLD_DLADDR,address,dl);
  105.                   return (int)v;
  106.           }
  107.  
  108. DDIIAAGGNNOOSSTTIICCSS
  109.      The function returns zero if the address cannot be associated with a
  110.      mapped-in object.  In such a case, the DDll__iinnffoo fields are not touched.
  111.  
  112.      The function returns non-zero if it can be associated with a mapped-in
  113.      object, and the DDll__iinnffoo fields are updated.
  114.  
  115. SSEEEE AALLSSOO
  116.      ddllooppeenn(3C), ddllcclloossee(3C), ddllssyymm(3C), ssggiiddllooppeenn__vveerrssiioonn(3C),
  117.      ssggiiddllooppeenn__vveerriissoonn(3C)
  118.      rrlldd(1)
  119.      ddssoo(5)
  120.  
  121.      This man page is available only online.
  122.